<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>红包领取详情列表</title>
    <link rel="stylesheet" type="text/css" th:href="@{/js/layui/css/layui.css}" media="all">
    <style>
        a{
            cursor:pointer;
        }
    </style>
</head>
<body class="body">
<!-- 表格 -->
<div id="dateTable" lay-filter="event"></div>
<script th:src="@{/js/layui/layui.js}"></script>
<script type="text/javascript" th:inline="javascript">
    layui.use(['table', 'form', 'layer'], function () {
        // 操作对象
        var form = layui.form
            , table = layui.table
            , $ = layui.jquery;

        // 表格渲染
        var tableIns = table.render({
            elem: '#dateTable'                  //指定原始表格元素选择器（推荐id选择器）
            , height: "full"    //容器高度
            // , skin: 'line'
            , even: 'true'
            , cols: [[                  //标题栏
                {field: 'receiveId', title: '好友ID', minWidth: '100', align: 'center', templet: function (d) {
                        return "<a style='color: #00C0F7' onclick='showPersion("+d.receiveId+");'>"+d.receiveId+"</a>";
                    }}
                ,{field: 'receiveName', title: '好友昵称', minWidth: '100', align: 'center'}
                ,{field: 'money', title: '领取金额', minWidth: '100', align: 'center'}
                , {
                    field: 'receiveTime',
                    align: 'center',
                    title: '领取时间',
                    sort: true,
                    minWidth: '150',
                }
            ]]
            , id: 'dataCheck'
            , url: [[${basePath}]] + '/packet/receive/list'
            , method: 'get'
            , page: true
            , limits: [10, 30, 60, 90, 150, 300]
            , limit: 10 //默认采用0
            , loading: true
            , where:  {
                packetId: [[${id}]]
            }
            , done: function (res, curr, count) {
                //如果是异步请求数据方式，res即为你接口返回的信息。
                //如果是直接赋值的方式，res即为：{data: [], count: 99} data为当前页数据、count为数据总长度
                $("td[data-field='content']").each(function () {
                    $(this).find(".layui-table-cell").removeClass('layui-table-cell');
                });
            }
        });
    });


    // 点击收发人id 进入其对应的收支详情
    function showPersion(receiveUserId) {
        // 关闭子页面中的弹框
        var index = layer.closeAll ();
        // 关闭父页面中的弹框
        parent.layer.close (index);

        layer.open({
            type: 2,
            title: '资金明细',
            shadeClose: true,
            shade: 0.2,
            maxmin: true, //开启最大化最小化按钮
            area: ['100%', '100%'],
            content: [[${basePath}]] + '/member/fundDetails?userId=' + receiveUserId
        });
    }
</script>
</body>
</html>